package com.msmall.community.admin.action;

import com.msmall.base.action.HTMLBaseAction;
import com.msmall.base.util.ConstantUrl;
import com.msmall.community.play.cases.model.Action;
import com.msmall.community.play.cases.model.Cases;
import com.msmall.community.play.cases.model.Scenario;
import com.msmall.community.play.cases.model.Target;
import com.msmall.community.play.cases.service.CasesManager;

/**
 * 后天PLAY.CASE管理
 *
 */
public class CasesAction extends HTMLBaseAction{
	  
	private static final long serialVersionUID = -6860381980150062574L;
	private Long casesId; 
	private Cases cases;//一个案子
	private Long actionId;
	private Action action;//动作
	private Long targetId;
	private Target target;//目标
	private Long scenarioId;
	private Scenario scenario;//场景
	
	private CasesManager casesManager;

	public String execute(){
		page.setClazz(Cases.class);
		page.setOrderBy("casesId");
		page.setOrder("asc");
		page.setPageSize(10);
		casesManager.getPagination(page);
		page.setUrl(ConstantUrl.ADMIN_PLAY_CASES_INDEX);
		return SUCCESS;
	}
	
	public String create(){
		casesId = null;
		cases = null;
		return SUCCESS;
	}
	
	public String update(){
		cases = (Cases) casesManager.get(Cases.class, casesId);
		return SUCCESS;
	}
	
	public String save(){
		casesManager.saveCases(cases, userid);
		return SUCCESS;
	}

	public Long getCasesId() {
		return casesId;
	}

	public void setCasesId(Long casesId) {
		this.casesId = casesId;
	}

	public Cases getCases() {
		return cases;
	}

	public void setCases(Cases cases) {
		this.cases = cases;
	}

	public Long getActionId() {
		return actionId;
	}

	public void setActionId(Long actionId) {
		this.actionId = actionId;
	}

	public Action getAction() {
		return action;
	}

	public void setAction(Action action) {
		this.action = action;
	}

	public Long getTargetId() {
		return targetId;
	}

	public void setTargetId(Long targetId) {
		this.targetId = targetId;
	}

	public Target getTarget() {
		return target;
	}

	public void setTarget(Target target) {
		this.target = target;
	}

	public Long getScenarioId() {
		return scenarioId;
	}

	public void setScenarioId(Long scenarioId) {
		this.scenarioId = scenarioId;
	}

	public Scenario getScenario() {
		return scenario;
	}

	public void setScenario(Scenario scenario) {
		this.scenario = scenario;
	}

	public void setCasesManager(CasesManager casesManager) {
		this.casesManager = casesManager;
	}
}
